package org.nepu.srr.作业人员风险.作业人员风险;

import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.nepu.sc.domain.DataVO;
import org.nepu.sc.domain.CommonMethods;

@Data
@ApiModel(value = "作业人员风险参数")
public class B51OperationPersonRiskParams {

    @ApiModelProperty("岗位证书(是否在有效期内)")
    DataVO jobCertificate;

    @ApiModelProperty("健康证(是否在有效期内)")
    DataVO healthCertificate;

    @ApiModelProperty("五小证、补差证、海上交通证(是否在有效期内)")
    DataVO fiveCertificate;

    @ApiModelProperty("安全生产知识与管理能力考核合格证(是否在有效期内)")
    DataVO safetyProductionKnowledgeCertificate;

    @ApiModelProperty("硫化氢防护(是否在有效期内)")
    DataVO sulfurHydrogenProtection;

    @ApiModelProperty("井控证(是否在有效期内)")
    DataVO wellControlCertificate;

    @ApiModelProperty("电工证(是否在有效期内)")
    DataVO electricianCertificate;

    @ApiModelProperty("焊工证(是否在有效期内)")
    DataVO welderCertificate;

    @ApiModelProperty("起重证（船吊）(是否在有效期内)")
    DataVO riggingCertificate;

    @ApiModelProperty("司索证(是否在有效期内)")
    DataVO sawCertificate;

    @ApiModelProperty("报务员证书(是否在有效期内)")
    DataVO accountantCertificate;

    @ApiModelProperty("餐饮行业健康证(是否在有效期内)")
    DataVO restaurantHealthCertificate;

    @ApiModelProperty("医师证书(是否在有效期内)")
    DataVO doctorCertificate;

    @ApiModelProperty("叉车驾驶员证(是否在有效期内)")
    DataVO forkliftDriverCertificate;

    public B51OperationPersonRiskResult rate(){
        double fullScore = 140;
        double rateScore = 0;
        if (jobCertificate.getData().equals("合格")){
            rateScore += 10;
        }
        if (healthCertificate.getData().equals("合格")){
            rateScore += 10;
        }
        if (fiveCertificate.getData().equals("合格")){
            rateScore += 10;
        }
        if (safetyProductionKnowledgeCertificate.getData().equals("合格")){
            rateScore += 10;
        }
        if (sulfurHydrogenProtection.getData().equals("合格")){
            rateScore += 10;
        }
        if (wellControlCertificate.getData().equals("合格")){
            rateScore += 10;
        }
        if (electricianCertificate.getData().equals("合格")){
            rateScore += 10;
        }
        if (welderCertificate.getData().equals("合格")){
            rateScore += 10;
        }
        if (riggingCertificate.getData().equals("合格")){
            rateScore += 10;
        }
        if (sawCertificate.getData().equals("合格")){
            rateScore += 10;
        }
        if (accountantCertificate.getData().equals("合格")){
            rateScore += 10;
        }
        if (restaurantHealthCertificate.getData().equals("合格")){
            rateScore += 10;
        }
        if (doctorCertificate.getData().equals("合格")){
            rateScore += 10;
        }
        if (forkliftDriverCertificate.getData().equals("合格")){
            rateScore += 10;
        }
        double score = rateScore / fullScore;
        B51OperationPersonRiskResult result = new B51OperationPersonRiskResult();
        result.setRateScore(score);
        String s = CommonMethods.toGrade(score);
        result.setRateResult(s);
        return result;
    }

}
